package cn.itcast.n3_Java线程;

import lombok.extern.slf4j.Slf4j;

import static cn.itcast.util.Sleeper.sleep;

/**
 * @program: juc
 * @description:
 * @author: flyduck
 * @create: 2024-08-30 11:24
 **/
@Slf4j(topic = "c.Test27_$$$$$_多线程习题_多线程泡茶喝")
public class Test27_$$$$$_多线程习题_多线程泡茶喝 {
    public static void main(String[] args) {
        Thread 老王 = new Thread(() -> {
            log.debug("洗水壶开始...");
            sleep(1);
            log.debug("洗水壶结束...");

            log.debug("烧开水开始...");
            sleep(5);
            log.debug("烧开水结束...");
        }, "老王");
        老王.start();

        Thread 小王 = new Thread(() -> {
            log.debug("========洗茶壶开始...");
            sleep(1);
            log.debug("========洗茶壶结束...");

            log.debug("========洗茶杯开始...");
            sleep(2);
            log.debug("========洗茶杯结束...");

            log.debug("========拿茶叶开始...");
            sleep(1);
            log.debug("========拿茶叶结束...");

            try {
                老王.join();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            log.debug("================可以泡茶了..");
        }, "小王");
        小王.start();


    }
}
